package controller;

import controller.editor.EditorController;
import view.CreateNewDiagramView;

public class CreateNewDiagramController extends Controller{

	private EditorController editorController;
	
	public CreateNewDiagramController(EditorController controller){
		this.editorController = controller;
	}
	
	@Override
	public void displayView() {
		if (CreateNewDiagramView.getInstance().getController() == null){
			CreateNewDiagramView.getInstance().setController(this);
		}
		CreateNewDiagramView.getInstance().show();
	}
	
	public void handleButtonAceptar(){
		CreateNewDiagramView.getInstance().hide();
		String diagramName = CreateNewDiagramView.getInstance().getDiagramName();
		getEditorController().addDiagramToProject(diagramName);
	}
	
	public void handleButtonCancelar(){
		CreateNewDiagramView.getInstance().hide();
	}

	public EditorController getEditorController() {
		return editorController;
	}

	public void setEditorController(EditorController editorController) {
		this.editorController = editorController;
	}

}
